package com.twu.bibilioteca;

import junit.framework.TestCase;
import org.junit.Before;
import org.junit.Test;

import static junit.framework.Assert.assertEquals;

/**
 * Created by IntelliJ IDEA.
 * User: dixithk
 * Date: 6/20/14
 * Time: 3:07 PM
 * To change this template use File | Settings | File Templates.
 */
public class ReturnMovieTest {

    Library lib =new Library();
    @Before
    public void load()
    {
        lib.loadMovies();
    }


    @Test
    public void shouldCheckForSuccessfullReturnMovie()
    {
        new CheckOutMovie(new UserInterfaceTest("manam") , lib).action();
        Result returnResult= new ReturnMovie(new UserInterfaceTest("manam") , lib).action();

        assertEquals(new Result("Thank you for returning the movie." , true) ,returnResult ) ;
    }

    @Test
    public void shouldCheckForUnSuccessfullReturnMovie()
    {

        Result returnResult= new ReturnMovie(new UserInterfaceTest("manam") , lib).action();

        assertEquals(new Result("That is not a valid movie to return." , false),returnResult ) ;
    }

    @Test

    public void shouldCheckJobOfClass()
    {
        assertEquals("Return a Movie",new ReturnMovie(new UserInterfaceApp(), lib).getName());
    }
}
